// 继承关系中的类域
#include <iostream>
using namespace std;

class A
{
public:
    int x = 1;
};

class B : public A
{
public:
    int x = 2;

    void f()
    {
        cout << x << endl;  //2
        cout << A ::x << endl;  //1
    }
};

int main(int argc, char const *argv[])
{
    B b;
    b.f();

    return 0;
}
